<template>
  <div class="app-container">
    <el-tree
    ref="tree2"
    :data="data2"
    :props="defaultProps"
    class="filter-tree"
    default-expand-all
    >
    </el-tree>

  </div>
</template>

<script>
  import request from '@/utils/request'
  export default {
    data() {
      return {
        filterText: '',
        data2: [],//表示所有分类数据
        defaultProps: {
          children: 'children',
          label: 'title'
        }
      }
    },
    created() {
     this.getAllSubjectList()
    },
    watch: {
      filterText(val) {
        this.$refs.tree2.filter(val)
      }
    },

    methods: {
      //得到所有分类集合
    async  getAllSubjectList() {
      const ret=  await request({
          url: `/eduservice/subject/getAllSubject`,
          method: 'get',
        })
          this.data2=ret.data.list
      },

    }
  }
</script>

<style scoped>

</style>
